package evocarcassonne.tileseteditor.ui.swing;

import evocarcassonne.core.abstractors.AbstractDrawableTile;

import javax.swing.*;
import java.awt.*;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;

public class SwingImage extends Image implements AbstractDrawableTile {

    Image image;

    public SwingImage(String resourceFile) {
        ImageIcon ii = new ImageIcon(this.getClass().getClassLoader().getResource(resourceFile));
        image = ii.getImage();
    }

    @Override
    public int getWidth(ImageObserver observer) {
        return image.getWidth(observer);
    }

    @Override
    public int getHeight(ImageObserver observer) {
        return image.getHeight(observer);
    }

    @Override
    public ImageProducer getSource() {
        return image.getSource();
    }

    @Override
    public Graphics getGraphics() {
        return image.getGraphics();
    }

    @Override
    public Object getProperty(String name, ImageObserver observer) {
        return image.getProperty(name, observer);
    }

    public Image getImage() {

        return image;
    }
}
